//
//  NewHomeCell.m
//  NewPro
//
//  Created by RYX on 2019/4/25.
//  Copyright © 2019 何荧红. All rights reserved.
//

#import "NewHomeCell.h"
#import "HomeNews.h"

@interface NewHomeCell ()

@property (weak, nonatomic) IBOutlet UIImageView *im;
@property (weak, nonatomic) IBOutlet UILabel *titleLa;
@property (weak, nonatomic) IBOutlet UILabel *readNumLa;
@property (weak, nonatomic) IBOutlet UILabel *dateLa;

@end

@implementation NewHomeCell

+ (instancetype)tempWithTableView:(UITableView *)tableView{
    
    NewHomeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CELL"];
    if (!cell) {
        
        ClassName
        cell = [[[NSBundle mainBundle] loadNibNamed:className owner:self options:nil] lastObject];
    }
    
    return cell;
}

- (void)setModel:(HomeNews *)model{
    
    [self.im sd_setImageWithURL:[NSURL URLWithString:model.img]];
    self.titleLa.text = model.bt;
    self.readNumLa.text = [NSString stringWithFormat:@"%@阅读",model.readNumber];
    
    NSString *timeStampString = [NSString stringWithFormat:@"%@",model.pushDate];
    NSTimeInterval interval =[timeStampString doubleValue] / 1000.0;
    NSDate *date  = [NSDate dateWithTimeIntervalSince1970:interval];
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"yyyy-MM-dd"];
    NSString *dateString  = [formatter stringFromDate: date];
    self.dateLa.text = dateString;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
